package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.Specialty;
import com.hs.sfzy.mapper.SpecialtyMapper;
import com.hs.sfzy.service.SpecialtyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName SpecialtyServiceImpl
 * @Description TODO
 * @Author 李明辉
 * @Date 2024年10月24日 17:16
 * @Version 1.0
 */
@Service
public class SpecialtyServiceImpl implements SpecialtyService {
    @Autowired
    private SpecialtyMapper specialtyMapper;
    @Override
    public int insert(Specialty specialty) {
        return specialtyMapper.insert(specialty);
    }

    @Override
    public int delete(Long id) {
        return specialtyMapper.delete(id);
    }

    @Override
    public int update(Specialty specialty) {
        return specialtyMapper.update(specialty);
    }

    @Override
    public List<Specialty> selectAll(Specialty specialty) {
        return specialtyMapper.selectAll(specialty);
    }

    @Override
    public Specialty selectById(Long id) {
        return specialtyMapper.selectById(id);
    }

    @Override
    public PageInfo<Specialty> selectByPageInfo(int pageNum, int pageSize, Specialty specialty) {
        PageHelper.startPage(pageNum, pageSize);
        List<Specialty> specialties = specialtyMapper.selectAll(specialty);
        PageInfo<Specialty> specialtyPageInfo = new PageInfo<Specialty>(specialties);
        return  specialtyPageInfo;
    }

    @Override
    public List<Specialty> findAll() {
        return specialtyMapper.findAll();
    }
}
